<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Exceptions</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../edit68k.css">
</head>

<body class="text">
<p class="heading">Sim68K - Exception Processing<hr noshade></p>
<p class="text">Exception processing can 
begin in several different ways.<br>
Generally, there are three classes of exception conditions:</p>
    
<p class="text">&nbsp;&nbsp;&nbsp; Group 
0: Reset, Address error, Bus error.<br>
&nbsp;&nbsp;&nbsp; Group 
1: Trace, Interrupt, Illegal, Privilege violation.<br>
&nbsp;&nbsp;&nbsp; Group 2: TRAP, TRAPV, CHK, 
and Divide by zero.</p>
<p class="text">A hardware reset may be 
generated by clicking the &quot;Reset&quot; button in the &quot;Hardware&quot; window.</p>
<p class="text">Address error occurs when an WORD_MASK or long WORD_MASK 
is written or read from an odd WORD_MASK boundary. i.e. an odd memory address.</p>
<p class="text">Bus error can occur in 
this simulator by attempting to read or write outside of the virtual memory 
space. The virtual memory for this simulator is from location 0 to location 
FFFFFF (hex).</p>
<p class="text">Interrupt occurs when an external device interrupts the processor's operation. 
Interrupts may be created manually or automatically from the &quot;Hardware&quot; window..</p>
<p class="text">Illegal exception occurs when an illegal instruction opcode 
is executed. It also occurs when the ILLEGAL instruction is executed.</p>
<p class="text">Privilege violation 
occurs when a privileged instruction is attempted and the supervisor bit in the 
status register is not set.</p>
<p class="text">TRAP exception occurs 
when a TRAP instruction is executed</p>
<p class="text">TRAPV exception occurs when a TRAPV 
instruction is executed</p>
<p class="text">CHK exception occurs when a CHK 
instruction is executed</p>
<p class="text">Divide by zero exception occurs when a DIVU or DIVS 
instruction attempts a division by zero.</p>
<p class="text">Exception processing begins by creating the appropriate exception stack frame 
for the particular exception group on the supervisor stack. Then, the supervisor 
mode is turned on and trace mode is turned off. After that, instruction 
execution resumes at the location referenced by the appropriate exception 
vector. The exception vector locations that can be used in this simulator are 
listed below:<br>
<br>
<b>Address<br>
<u>(Hex)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Assignment&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br>
</u></b>&nbsp;000&nbsp;&nbsp;&nbsp;&nbsp; Reset: Initial SSP<br>
&nbsp;004&nbsp;&nbsp;&nbsp;&nbsp; Reset: Initial PC<br>
&nbsp;008&nbsp;&nbsp;&nbsp;&nbsp; Bus error<br>
&nbsp;00C&nbsp;&nbsp;&nbsp;&nbsp; Address error<br>
&nbsp;010&nbsp;&nbsp;&nbsp;&nbsp; Illegal instruction<br>
&nbsp;014&nbsp;&nbsp;&nbsp;&nbsp; Divide by zero<br>
&nbsp;018&nbsp;&nbsp;&nbsp;&nbsp; CHK instruction<br>
&nbsp;01C&nbsp;&nbsp;&nbsp;&nbsp; TRAPV instruction<br>
&nbsp;020&nbsp;&nbsp;&nbsp;&nbsp; Privilege violation<br>
&nbsp;024&nbsp;&nbsp;&nbsp;&nbsp; Trace<br>
&nbsp;028&nbsp;&nbsp;&nbsp;&nbsp; Line 1010 emulator<br>
&nbsp;02C&nbsp;&nbsp;&nbsp;&nbsp; Line 1111 emulator<br>
&nbsp;064&nbsp;&nbsp;&nbsp;&nbsp; Level 1 Interrupt<br>
&nbsp;068&nbsp;&nbsp;&nbsp;&nbsp; Level 2 Interrupt<br>
&nbsp;06C&nbsp;&nbsp;&nbsp;&nbsp; Level 3 Interrupt<br>
&nbsp;070&nbsp;&nbsp;&nbsp;&nbsp; Level 4 Interrupt<br>
&nbsp;074&nbsp;&nbsp;&nbsp;&nbsp; Level 5 Interrupt<br>
&nbsp;078&nbsp;&nbsp;&nbsp;&nbsp; Level 6 Interrupt<br>
&nbsp;07C&nbsp;&nbsp;&nbsp;&nbsp; Level 7 Interrupt<br>
&nbsp;080-0BC TRAP instruction vectors</p>
<p class="text">When the simulator starts up the supervisor bit is set on and the supervisor 
stack pointer is set to the value 1000000 (hex). Note that the stack grows 
downward, so the stack frame for any exceptions will grow from $1000000 
downward.</p>
</body>
</html>